// packageJ/consensus_activity/my/my.js
const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    avatar_image: "",
    grade_name: "",
    user_name: "",
    is_partner: 0,
    other_assets: {},
    custom_name: {},
    usable_yuan: 0,
    add_weight_bonus_pool:0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    this.getData();
  },
  getData() {
    app._getNetWork({
      url: app.getNetAddresss('plugin.wise-yuan-trade.frontend.my.index'),
      success: resdata => {
        let {
          result,
          data,
          msg
        } = resdata.data;
        if (result) {
          this.setData({
            avatar_image: data.avatar_image,
            grade_name: data.grade_name,
            is_partner: data.is_partner,
            usable_yuan: data.usable_yuan,
            user_name: data.user_name,
            other_assets: data.other_assets,
            custom_name: data.custom_name,
            add_weight_bonus_pool:data.add_weight_bonus_pool,
          })
        } else {
          app.tips(msg);
        }
      }
    })

  },

  goto(e) {
    let url = e.currentTarget.dataset.url;
    let num = Number(e.currentTarget.dataset.params);
    if (num) {
      if(num == 5){
        wx.navigateTo({
          url: `/packageJ/consensus_activity/${url}/${url}?num=${num}&count=${this.data.other_assets.add_weight}`,
        })
      }else{
        wx.navigateTo({
          url: `/packageJ/consensus_activity/${url}/${url}?num=${num}`,
        })
      }
    } else {
      
      wx.navigateTo({
        url: `/packageJ/consensus_activity/${url}/${url}`,
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})